from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.scrollview import ScrollView


class MyApp(App):
    def build(self):
        root = Builder.load_file('99-ScrollView.kv')
        # boxLayout = BoxLayout(orientation='vertical')
        #
        # scroll_view = ScrollView(size_hint=(1, 1))
        # # 创建一个内部布局来放置多个标签
        # inner_layout = BoxLayout(orientation='vertical', size_hint_y=None)
        # inner_layout.bind(minimum_height=inner_layout.setter('height'))  # 绑定高度
        #
        # # 添加多个标签
        # for i in range(30):
        #     inner_layout.add_widget(Label(text=f'Item {i + 1}', size_hint_y=None, height=40))
        #
        # scroll_view.add_widget(inner_layout)
        # boxLayout.add_widget(scroll_view)
        # root.add_widget(boxLayout)

        return root

if __name__ == '__main__':
    MyApp().run()

